package com.five.dao.impl.backstage;

import com.five.dao.backstage.XuFangDao;
import com.five.entity.backstage.XuFang;
import com.five.util.DBUtil;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @ClassName XuFangDaoImpl
 * @Description TODO
 * @Author yuanshuaiqiang
 * @Date 2020/12/6 18:34
 */
@Repository
public class XuFangDaoImpl implements XuFangDao {
    @Override
    public List<Map> queryAll(Integer page, Integer limit) {
        String sql="select tx.*,tr.name name,tr.tel tel from t_xufang tx join t_ruzhudetail tr on\n" +
                " tx.ruzhuid=tr.ruzhuid limit ?,?";
        return DBUtil.queryMap(sql,(page-1)*limit,limit);
    }

    @Override
    public int getcount() {
        String sql="select count(*) a from t_xufang tx join t_ruzhudetail tr on\n" +
                " tx.ruzhuid=tr.ruzhuid  ";
        List<Map> maps = DBUtil.queryMap(sql);
        String s = maps.get(0).get("a") + "";
        int i = Integer.parseInt(s);
        return i;
    }

}
